package models;

import play.mvc.*;
import play.libs.*;
import scala.concurrent.Await;
import scala.concurrent.duration.Duration;
import akka.actor.*;
import static akka.pattern.Patterns.ask;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;

import java.util.*;

import models.msgs.*;
import models.msgs.Number;
import static java.util.concurrent.TimeUnit.*;



public class playerInfo {

private String name;
private int id;
private int MyStack;
private boolean MyTurn = false;
private boolean Allin = false;  //flaga czy gracz jest all in
private boolean Alive = false;
private boolean Active = false;
private Cards Hand[] = new Cards[4];
private int StakeDone;
private int MIN = 0;
private String Message;
private int Money = 0;




//class constructro//
public playerInfo(String n,int ID)
{

	name = n;
	id = ID;                //przekazujemy sobie podstawoe informacje(nazwa i ktory gracz)
	MyStack = 2500;         //kazdy z graczy bedzie mial 2500 krazkow
	Alive = true;
	StakeDone = 0;
	Message = "";

}




public String getName() { return name;}
public int getId() {return id;}
public int getStack() {return MyStack;}
public Cards[] Hand() { return Hand;}
public boolean isAlive() { return Alive;}
public Cards getCard(int x) { return Hand[x];}
public int getMin(){ return MIN;}
public int getSD(){return StakeDone;}
public String getMessage() { return Message;}
public int getStake(){return StakeDone;}
public void setTurn(int x ){ 
	MyTurn = true;
	MIN = x;
	Message = "TURN";
}




public void takeCards(int x, Cards card ){
//x-ktora karta(index od 0 do 3)
//c-nasza karta
Hand[x] = card;  
}


//SmallBling taken from player
public int SmallBLind(){
	MyStack = MyStack - 15;
	StakeDone = 15;
		return 15;
	}
//Big Blind taken from a player
public int BigBlind(){
	MyStack = MyStack - 30;
	StakeDone = 30;
	return 30;
}


public int Call(){
	MyStack = MyStack - MIN + StakeDone;
	StakeDone = MIN - StakeDone + StakeDone;
	return StakeDone-MIN;
}
public int Allin(){
	StakeDone = StakeDone + MyStack;
	MyStack = 0;
	Allin = true;
	return StakeDone;

}
public int Pass(){
	Active = false;
	return 0;
}
public int Raise(int x){
	MyStack = MyStack - x - MIN + StakeDone;
	StakeDone = x + MIN - StakeDone;
	return x + StakeDone - MIN;


}






}